package com.zxl.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.zxl.annotations.RedisCacheEvict;
import com.zxl.annotations.RedisCacheable;
import com.zxl.entity.TCheckDataTool;
import com.zxl.service.DcGovernanceToolService;
import com.zxl.support.Constants;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;


/**
 * Created by CodeGenerator on 2021/07/28.
 */
@Service
public class DcGovernanceToolServiceImpl implements DcGovernanceToolService {

    @Override
    @RedisCacheable(keyPrefix = Constants.T_CHECK_DATA_TOOL, matchValue = "#module+#configKey", timeout = 10L, timeUnit = TimeUnit.MINUTES)
    public JSONObject findCaptureByModuleAndConfigKey(String module, String configKey) {
        return (JSONObject) JSONObject.toJSON(null);
    }

    /**
     * 更新抓拍过滤时间值，如果redis存在数据，删除redis数据，然后更新数据库并更新redis
     *
     * @Param tCheckDataTool
     * @Param module
     * @Param configKey
     */
    @Override
    @RedisCacheEvict(keyPrefix = Constants.T_CHECK_DATA_TOOL, matchValue = "#module+#configKey", timeout = 20L, timeUnit = TimeUnit.HOURS)
    public void updateCaptureParam(TCheckDataTool tCheckDataTool, String module, String configKey) {
        System.out.println("更新");
    }
}
